package com.wjs.zpro.service.impl;

import cn.hutool.crypto.SecureUtil;
import com.wjs.zpro.dao.impl.UserDaoImpl;
import com.wjs.zpro.entity.UserEntity;
import com.wjs.zpro.service.UserService;

import java.sql.SQLException;

public class UserServiceImpl implements UserService {
    @Override
    public void register(UserEntity user) throws SQLException {
        //TODO:用户注册
        System.out.println("UserService 处理注册------"+ user);

        UserDaoImpl userDao = new UserDaoImpl();

        //user数据加密
        //MD5

        //传来的密码
        String password = user.getPassword();
        // 加密后的密码
        String md5 = SecureUtil.md5(password);
        user.setPassword(md5);
        userDao.save(user);

    }
}
